package com.example.sofa_module.sofa.details;

import com.example.common.entity.BaseEntity;
import com.example.common.mvvm.databus.LiveDataBus;
import com.example.common.mvvm.viewmodel.BaseViewModel;
import com.example.sofa_module.sofa.details.entity.DetailsEntity;
import com.example.sofa_module.sofa.details.entity.DetakisEntity;

import java.util.List;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

public class DetailsViewModel extends BaseViewModel<DetailsModel> {
    public LiveDataBus<List<DetakisEntity>>detail_list=new LiveDataBus<>();

    @Override
    public void onResult(BaseEntity entity) {
        if (entity instanceof DetailsEntity){
            DetailsEntity detailsEntity= (DetailsEntity) entity;
            detail_list.postValue(detailsEntity.data.getData());
        }
    }

    @Override
    protected void initData() {

    }

    public void requestDealist(long itemid){
        respository.requestInvitationList(itemid)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(this);
    }
}
